package com.bsbm.mappers;

import com.bsbm.profile.bean.ProfileBean;
import com.bsbm.profile.domain.Profile;

/**
 * Created with IntelliJ IDEA.
 * User: SABIR IQBAL
 * Date: 1/6/14
 * Time: 11:05 PM
 * To change this template use File | Settings | File Templates.
 */
public class ProfileMapper {
    public static Profile getDoaminFromBean(ProfileBean bean){
        Profile domain = new Profile();
        domain.setUpdatedOn(bean.getUpdatedOn());
        domain.setAddress(AddressMapper.getDomainFromBean(bean.getAddressBean()));
        domain.setProfileType(bean.getProfileType());
        domain.setMiddleName(bean.getMiddleName());
        domain.setCreatedBy(bean.getCreatedBy());
        domain.setCreatedOn(bean.getCreatedOn());
        domain.setFirstName(bean.getFirstName());
        domain.setLastName(bean.getLastName());
        domain.setId(bean.getId());
        return domain;
    }

    public static ProfileBean getBeanFromDoamin(Profile domain){
        ProfileBean bean = new ProfileBean();
        bean.setUpdatedOn(domain.getUpdatedOn());
        bean.setAddressBean(AddressMapper.getBeanFromDomain(domain.getAddress()));
        bean.setProfileType(domain.getProfileType());
        bean.setMiddleName(domain.getMiddleName());
        bean.setCreatedBy(domain.getCreatedBy());
        bean.setCreatedOn(domain.getCreatedOn());
        bean.setFirstName(domain.getFirstName());
        bean.setLastName(domain.getLastName());
        bean.setId(domain.getId());
        return bean;
    }
}
